/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package parismetro;

import javafx.scene.CustomNode;
import javafx.scene.Node;
import javafx.scene.layout.Stack;
import javafx.scene.Group;
import javafx.scene.text.Font;
import javafx.scene.shape.Rectangle;
import javafx.scene.text.Text;
import javafx.scene.paint.Color;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.VBox;
import javafx.geometry.HPos;

/**
 * @author Hadrien
 */
def f: Font = Font { size: 48, embolden: true };
def f24: Font = Font { size: 28, embolden: true };

public class ButtonInfo extends CustomNode {

    public-init var coul: Color;
    public-init var texte: String;
    public-init var action: function(: MouseEvent): Void;
    public-init var actionInfo: function(: MouseEvent): Void;
    public var largeur = 285;
    public var s: Group = Group {
                //effect: bind e
                content: [
                    Rectangle {
                        arcWidth: 30, arcHeight: 30
                        //fill: bind coul
                        fill: coul
                        height: 125;
                        width: bind largeur;
                        stroke: Color.WHITE;
                        strokeWidth: 5;
                        onMousePressed: function(e: MouseEvent): Void {
                            action(e);
                        }
                    },
                    Rectangle {
                        layoutY: 7
                        layoutX: bind largeur - 77
                        arcWidth: 20, arcHeight: 20
                        //fill: bind coul
                        fill: Color.WHITE
                        stroke: bind Main.bordure
                        strokeWidth: 3
                        height: 111;
                        width: 70;
                        blocksMouse: true;
                        onMousePressed: function(e: MouseEvent): Void {
                            actionInfo(e);
                        }
                    },
                    VBox {
                        nodeHPos: HPos.CENTER;
                        hpos: HPos.CENTER;
                        spacing: -8;
                        layoutY: 7
                        layoutX: bind largeur - 52
                        content: [Text {
                                font: f24
                                content: "I"
                            }, Text {
                                font: f24
                                content: "N"
                            }, Text {
                                font: f24
                                content: "F"
                            }, Text {
                                font: f24
                                content: "O"
                            }
                        ]
                    }

                    Text {
                        layoutY: (f.size);
                        layoutX: 10;
                        font: f
                        content: texte
                        fill: Color.WHITE
                    }
                ]
            }

    override public function create(): Node {
        return s;
    }

}
